""markdown插件设置
let g:vim_markdown_folding_level = 5

" Use tab for trigger completion with characters ahead and navigate.
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
" other plugin before putting this into your config.
inoremap <silent><expr> <TAB>
      \ pumvisible() ? "\<C-j>" :
      \ <SID>check_back_space() ? "\<TAB>" :
      \ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-k>" : "\<C-h>"

function! s:check_back_space() abort
  let col = col('.') - 1
  return !col || getline('.')[col - 1]  =~# '\s'
endfunction

" Use <c-space> to trigger completion.
if has('nvim')
  inoremap <silent><expr> <c-space> coc#refresh()
else
  inoremap <silent><expr> <c-@> coc#refresh()
endif

" Make <CR> auto-select the first completion item and notify coc.nvim to
" format on enter, <cr> could be remapped by other vim plugin
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm() : 
                                           \"\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
lua require 'user'
"coc-snippets config
" Use <C-l> for trigger snippet expand.
"xmap <leader>x  <Plug>(coc-convert-snippet)
inoremap <silent><expr> <C-l>
      \ pumvisible() ? coc#_select_confirm() :
      \ coc#expandableOrJumpable() ? "\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<CR>" :
      \ <SID>check_back_space() ? "\<C-s>" :
      \ coc#refresh()
function! s:check_back_space() abort
  let col = col('.') - 1
  return !col || getline('.')[col - 1]  =~# '\s'
endfunction
let g:coc_snippet_next = '<C-l>'
let g:cursorword = 0
    augroup user_plugin_cursorword
      autocmd!
      autocmd FileType json,yaml,markdown,nginx,dosini,conf,text,c,cpp,html,css
        \ let b:cursorword = 1
      autocmd WinEnter * if &diff || &pvw | let b:cursorword = 0 | endif
      autocmd InsertEnter * if get(b:, 'cursorword', 0) == 1
        \| let b:cursorword = 0
        \| endif
      autocmd InsertLeave * if get(b:, 'cursorword', 1) == 0
        \| let b:cursorword = 1
        \| endif
    augroup END

" Add support for markdown files in tagbar.
let g:tagbar_type_markdown = {
    \ 'ctagstype': 'markdown',
    \ 'ctagsbin' : 'markdown2ctags',
    \ 'ctagsargs' : '-f - --sort=yes --sro=»',
    \ 'kinds' : [
        \ 's:sections',
        \ 'i:images'
    \ ],
    \ 'sro' : '»',
    \ 'kind2scope' : {
        \ 's' : 'section',
    \ },
    \ 'sort': 0,
\ }

hi default CursorWord cterm=None ctermfg=green 

""fzf config
" 输入上方，搜索列表在下方
"let $FZF_DEFAULT_OPTS = '--layout=reverse'
"let g:fzf_layout = {'down':'~40%'}
"浮动框显示
let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.6 } }
let g:indent_guides_guide_size            = 1  " 指定对齐线的尺寸
let g:indent_guides_start_level           = 2  " 从第二层开始可视化显示缩进
"glow setting
let g:glow_style = "~/mystyle.json"
"patsnap function setting 
let g:searchbrowser="microsoft-edge-stable"
"markdownpreview setting 
let g:mkdp_browser ='microsoft-edge-stable'
call which_key#register('<Space>', "g:which_key_map")
nnoremap <silent> <leader> :<c-u>WhichKey '<Space>'<CR>
nnoremap <silent> <localleader> :<c-u>WhichKey  ','<CR>
"Auto pairs setting
let g:niceblock_no_default_key_mappings = 0
autocmd FileType json syntax match Comment +\/\/.\+$+
"vimtex setting
let g:vimtex_view_method = 'zathura'

